FROM php:7.0.33-fpm-alpine


ARG with_composer=yes

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk update \
&& docker-php-source extract \
&& apk add git \
&& apk add --no-cache $PHPIZE_DEPS \
&& apk add --no-cache libzip-dev libmcrypt-dev linux-headers libpng-dev \
&& docker-php-ext-install pdo_mysql zip bcmath mcrypt gd \
&& pecl install redis-3.1.6 xdebug-2.8.1 swoole-1.9.23 \
&& docker-php-ext-enable swoole redis xdebug \
&& apk del $PHPIZE_DEPS \
&& docker-php-source delete \
&& rm -rf /var/cache/apk/* \
&& rm -rf /tmp/pear ~/.pearrc \
&& if [ "$with_composer" = "yes" ]; then php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');";fi

COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

EXPOSE 9000